﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace ComData
{
    public class F2
    {
        [XmlAttribute]
        public float X;
        [XmlAttribute]
        public float Y;


        public F2()
        {
            X = 0F;
            Y = 0F;
        }
        public F2(float x, float y)
        {
            X = x;
            Y = y;
        }
        public override string ToString()
        {
            return string.Format("{0},{1}", X, Y);
        }

        public string ToString(string format)
        {
            string sf = "{0:" + format + "},{1:" + format + "}";
            return string.Format(sf, X, Y);
        }
        static public F2 operator -(F2 a, F2 b)
        {
            return new F2(a.X - b.X, a.Y - b.Y);
        }

        static public F2 operator +(F2 a, F2 b)
        {
            return new F2(a.X + b.X, a.Y + b.Y);
        }
    }
}
